<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
 */

Route::get('/', 'HomeController@index');

Route::group(['middleware' => ['admin']], function () {
	//商家板
	Route::get('/business', 'BusinessController@index')->name('business');
	Route::get('/business/list', 'BusinessController@list');
	Route::get('/business/edit/{map}/{type}', 'BusinessController@edit');
	Route::get('/business/create/{type}', 'BusinessController@create');
	Route::post('/business', 'BusinessController@store');
	//获取一个商家下的所有活动
	Route::get('/business/activitys/{id}', 'BusinessController@activitys');
	Route::delete('/business/{map}', 'BusinessController@destroy');

	//活动版
	Route::get('/activitys', 'ActivityController@activitys');
	Route::post('/activity', 'ActivityController@store');
	Route::get('/activitys/list', 'ActivityController@list');
	Route::get('/activitys/create', 'ActivityController@create');
	Route::get('/activitys/edit/{activity}', 'ActivityController@edit');
	Route::delete('/activity/{id}', 'ActivityController@destroy');
	Route::get('/activity/changeStatus/{id}', 'ActivityController@changeStatus');
	//获取一个活动下的所有渠道
	Route::get('/activity/types/{id}', 'ActivityController@types');

	//渠道版
	Route::get('/types', 'TypeController@types');
	Route::get('/types/list', 'TypeController@list');
	Route::get('/types/create', 'TypeController@create');
	Route::get('/types/edit/{type}', 'TypeController@edit');
	Route::delete('/type/{id}', 'TypeController@destroy');
	Route::post('/type', 'TypeController@store');

	//订单版
	Route::get('/orders', 'OrderController@index')->name('order');
	Route::get('/orders/list', 'OrderController@list');
	Route::get('/order/detail/{id}', 'OrderController@detail')->name('order.detail');
	Route::get('/order/import', 'OrderController@import');
	Route::delete('/order/{id}', 'OrderController@destroy');

	//订单处理板
	Route::get('/sendOrders', 'SendOrdersController@index');
	Route::get('/sendOrders/list', 'SendOrdersController@list');
	Route::get('/sendOrder/detail/{id}', 'SendOrdersController@detail')->name('sendOrder.detail');
	Route::post('/sendOrder/ship/{sendOrder}', 'SendOrdersController@activityShip');

	//统计版
	Route::get('/analysis', 'AnalysisController@index');
	Route::get('/analysicNum', 'AnalysisController@getNums');
	Route::get('/analysicChart', 'AnalysisController@getCharts');

	//Excel板
	Route::post('/upload/{map}/{type}', 'ExcelController@upload')->name('upload');
	Route::get('/export/{id}', 'ExcelController@export');
	Route::get('/exportError', 'ExcelController@exportError');

	Route::post('/uploadImage', 'UploadController@upload');

	// Route::get('/activity/{business}', 'ActivityController@activitys');
	//获取一个活动下的所有渠道
	Route::get('/type/{id}', 'ActivityController@types');
	//给一个渠道赋予excel映射关系
	Route::post('/relation/{type}', 'RelationController@store');
	//获取一个渠道的excel映射关系
	Route::get('/relation/{type}', 'RelationController@index');
	//在一个商家下新增活动 !新增活动时必须选择渠道
	Route::post('/activity/{business}', 'ActivityController@store');
	//新增渠道与活动的映射关系 !在已有活动中新增渠道
	Route::get('/map/{type}', 'ActivityController@map');
});
//分享页面
Route::get('/share/{unique}', 'ActivityController@share')->name('share');
